Skip to content

feat(player): drag the seek bar by relative movement, tap still jumps - #5

Open
The-R0 wants to merge 1 commit into
NihilDigit:mainfrom
The-R0:pr-seekbar-relative-drag
Open

The-R0 wants to merge 1 commit into
NihilDigit:mainfrom
The-R0:pr-seekbar-relative-drag

Conversation

@The-R0

@The-R0 The-R0 commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

变化

  • 进度条拖拽改为相对位移,点按仍直接跳转(SeekBar.kt):
    • 进度条触控区高 48dp、视觉槽高 3dp,原先 detectHorizontalDragGestures 在 onDragStart 时直接按手指落点的绝对横坐标跳转,手指按下抓滑块时只要稍偏几毫米就会先发生一次跳变。
    • 现改为在 onDragStart 记录按下时刻的当前进度比例 dragStartFraction,拖动中按累计水平位移 �ccumulatedDelta / size.width 相对推进;不滑动的单击(detectTapGestures)仍直接跳到落点位置。

截图

进度条相对拖拽对比

Keep single-tap jumping directly to the tapped position while making horizontal drag advance relative to the thumb's starting position on touch-down so grabbing the 48dp touch strip near the thumb does not cause an initial jump.
@NihilDigit

Copy link
Copy Markdown
Owner

桌面端进度条有鼠标悬停时间预览气泡(hoverX),鼠标移过去看到预览时间再按下拖动时,预期是从光标落点直接拖;如果也走相对位移,按下瞬间反而会跳回原播放位置。

请按指针事件的 PointerType 区分(兼顾带触屏的 Windows 设备):PointerType.Touch 走相对位移,PointerType.Mouse 保持原来的绝对位置拖拽。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants